﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;

/// <summary>
///JsHelper 的摘要说明
/// </summary>
public class JsHelper
{
	public JsHelper()
	{
		//
		//TODO: 在此处添加构造函数逻辑
		//
	}
    public static void Alert(string strMsg, Page page)
    {
        string js = @"<Script language='JavaScript'>
                        alert('" + strMsg + "');window.location.href=window.location.href;</Script>";
        page.ClientScript.RegisterClientScriptBlock(typeof(Page), "alert", js);
    }
    public static void Alert(string strMsg)
    {
        string js = @"<Script language='JavaScript'>
                        alert('" + strMsg + "');window.location.href=window.location.href;</Script>";
        HttpContext.Current.Response.Write(js);
    }

    public static string AlertConfirm(string Str)
    {
        return "return confirm('" + Str + "')";

    }

    public static void AlertBaoLiu(string message, Page page)
    {
        string js = @"<Script language='JavaScript'>
                        alert('" + message + "');</Script>";
        page.ClientScript.RegisterClientScriptBlock(typeof(Page), "alertbl", js);

    }

    public static void AlertRedirect(string message, string path, Page page)
    {
        string js = @"<Script language='JavaScript'>
                        alert('" + message + "');window.location.href='" + path + "';</Script>";
        page.ClientScript.RegisterClientScriptBlock(typeof(Page), "AlertRedirect", js);
    }
    public static void ParentRedirect(string url, Page page)
    {
        string js = @"<Script language='JavaScript'>                      parent.window.location.href='" + url + "';</Script>";
        page.ClientScript.RegisterClientScriptBlock(typeof(Page), "ParentRedirect", js);
    }
    public static void TopAlertRedirect(string message, string path, Page page)
    {
        string js = @"<Script language='JavaScript'>
                        alert('" + message + "');parent.window.location.href='" + path + "';</Script>";
        HttpContext.Current.Response.Write(js);
        //  page.ClientScript.RegisterClientScriptBlock(typeof(Page), "TopAlertRedirect", js,false);
    }
}